import 'storage.dart';

class UserServices {
  // 获取用户信息
  static Future<List> getUserInfo() async {
    List? userInfo = await Storage.getData('userinfo');
    if (userInfo != null) {
      return userInfo;
    } else {
      return [];
    }
  }

  // 获取登录状态
  static Future<bool> getUserLoginState() async {
    List? userInfo = await getUserInfo();
    if (userInfo.isNotEmpty &&
        userInfo != [] &&
        userInfo[0]['username'] != '') {
      return true;
    } else {
      return false;
    }
  }
}
